I think I'd like a bit more techy answers - I always assumed that essentially the only info the cars ECUs needed out of the battery pack was the current voltage - everything else re BMS balancing etc is sort of packaged into the battery module - in which case, as long as you can recreate those factors with an after-market setup you'd be ok - but I'll be honest, I'd completely forgotten the cost element !!
Depends how you define a BMS, as the overall battery management system is usually distributed among a number of ECU's.
Usually there are cell management units in the battery pack itself which measure the voltage of individual cells and perform the balancing of individual cells. (By switching a resistor across the cell when it needs bleeding down) Typically one of these cell management units will handle a number of cells - in my Ion each CMU handles 4 or 8 cells with most of them handling 8 cells. CMU's may also handle the measurement of cell temperatures. On the Ion there are 66 temperature sensors spread among 88 cells, or three sensors per 4 cells. In a Leaf there are only 3 sensors for the entire pack!
Then you have the BMU or battery management unit - this is another ECU which has "overall" control of the battery, and is probably the one most people think of. It communicates with each individual CMU, obtaining voltage readings from them for every cell, (and in some cars temperature readings) it will also measure the current in/out of the pack using a hall effect sensor so it knows when the pack is charging or discharging and at what rate.
It commands the CMU units to switch on balancers for individual cells that need balancing during charging. It has the characteristics of the cells programmed into it, such as a topographic map describing the maximum charge and discharge current for different cell temperatures (primarily to reduce charging rates at very low or high temperatures) as well as the minimum and maximum cell voltages allowed.
It will communicate with the motor control unit to tell it maximum allowed charge (regeneration) and discharge rates based on the current cell temperatures and state of charge. It will also communicate with the onboard charger (which usually also handles rapid charger communication) to tell it the maximum allowed charging rate at any given time based on SoC, cell temperatures and cell voltages.
Another job it has is to keep track of state of charge and state of health of the battery. This is typically done using a combination of voltage estimation and coloumb counting, along with topographic maps of the performance of the cells in adverse conditions such as high charge and discharge rates and temperature extremes.
It will also be responsible for requesting heating or cooling of the pack from the car, if the car has such a facility, and deciding what the acceptable or optimal working cell temperature range is before performance should be limited.
In short the BMS is very intracately programmed with the characteristics of the cells and how to "treat them right" for both safety (don't let them blow up) and longevity over the years.
Although most Lithium Ion chemistries have the same working voltage range (4.1 volts down to about 3.0-3.6 volts) meaning that you could in theory replace the cells with cells of equal or greater capacity/performance, it's unlikely to be that easy or even safe in practice.
While newer cells of a different design may have a higher capacity in a smaller space, they might be more particular about operating temperatures for example - some older lower density cells such as those in my Ion are more thermally stable than some of the newer high energy density types, thus the old cells get away with no active cooling without becoming unsafe, however the newer cells require active cooling and could potentially be dangerous if operated without cooling by a BMS which is not aware of their temperature sensitivity. (Such as the cells used in Tesla's)
Likewise reducing chrage rates at low temperaures is critical to avoid Lithium plating the anode which results in capacity loss and eventual short circuits and catastrophic failure, and it's not automatically the case that a newer higher capacity cell has superior low temperature charging ability. If it does not, the BMS would push it outside its safe working area in a way that may not show up for months or years until the battery catches fire due to gradual dendrite build up resulting in catastrophic failure due to a short. (In other words you've created a ticking timebomb)
Another issue is that the BMS might or might not be able to "understand" the increased capacity of a battery with after market higher capacity cells. It will be programmed with a factory new default value (45.8Ah for my Ion) and adapt as the battery gradually loses capacity, however despite the ECU having a "battery calibration" routine that can be triggered by a diagnostic tool to learn the battery capacity, there are no guarentees that it would be willing to learn a capacity that is significantly
higher than a factory new capacity, as the feature is specifically to measure the performance of a degraded battery. It may look upon a much higher than new Ah measurement as an error condition instead, in which case the additional capacity of the cells cannot be used.
This will depend on the programming of the BMU and is thus on a case by case basis for a model of car, and possibly even dependent on firmware versions of the BMU.
In short, a major change to the battery chemistry and/or capacity is unlikely to be either safe, or take full advantage of the cells with a stock unmodified BMU.
To do a significant 3rd party upgrade of the cells to a higher capacity and/or different more dense chemistry you're realistically looking at either reprograming the BMU with the characteristics of the new cells (including their safe operating region for temperaure, current and so on, and a willingness of the ECU to believe the higher capacity) or using an after market programmable BMU, in the same way that you can get after market Engine Management ECU's for ICE vehicles.
In the first instance you're talking about finding a specialist ECU hacker/reprogrammer to try to decode the firmware of the unit and flash it with a patched version of the firmware and then hope that a dealer doesn't accidentally reflash it in the future - you'd probably only do this on an out of warranty car.
In the second instance after market programmable BMU's are available and could be readily programmed with the characteristics of the cells, certainly much easier than trying to reverse engineer the firmware in the original BMU, however you then have the problem that this after market BMU has to know how to communicate with the CMU's in the car, the on board charger, the motor control unit etc...
So instead of having to reverse engineer the BMU's firmware you instead have to reverse engineer the the communications protocols between the ECU's.... In my opinion probably an easier task since Can Bus traffic can be sniffed and reverse engineered.
However you then might run into issues with VIN coding between the ECU's, and just cross your fingers that there isn't any sort of cryptographic stuff going on between the different ECU's. And while you'd get away with it on most cars that don't do over the air firmware updates, forget about ever doing something like this on a Tesla.
It's going to take some very knowledgable, skilled and persistent people to figure this stuff out on a model by model basis unfortunately unless manufacturers are forced to open up their "proprietary" BMS firmware and/or over the wire communication protocols to allow after market BMS's to be implemented easily. (Personally I think this should be legislated, on the basis of "right to repair", where repair means having to replace the cells with newer types when originals are no longer available...)
In the long term I think 3rd party battery upgrades will happen - but only for popular models of EV that are worth upgrading the battery on when they get to a certain age, and probably not for a good few years yet as there just isn't the demand at the moment.