Acceleration when device is on tilt
Only a sketch of a solution.

Take all 3 axes into consideration.

Acceleration due to gravity, regardless of tilt, will always be 1G, as a vector sum of X,Y,Z, no matter what the tilt. You can picture the acceleration at rest or steady motion as a point on a sphere with radius 1G. (If you are perfectly horizontal, that point will be (0, 0, -1) i.e. directly below you).

Acceleration due to braking will distort the sphere itself; the vector sum of X,Y,Z will no longer be 1G.

So

$$A = \sqrt{X^2 + Y^2 + Z^2}$$

gives you the total acceleration. If it equals G you are at rest; otherwise you are accelerating, and \$A\$ is the vector sum of G and the true acceleration.

You now have to find the true acceleration which will normally be a vector in the forward (or rearward) direction which explains the difference between \$A\$ and G. You need to subtract some point on the G sphere from \$A\$, to find a (hopefully unique solution) vector with only an X (forward/backward) component. That is your acceleration. (I'll leave the trigonometry as a simple puzzle, hopefully the idea is clear).

Unless you are also turning or skidding, so you need inputs from steering wheel and ABS to be sure; that becomes a data fusion problem. This approach will provide an estimate of acceleration. To sanity-check and refine that estimate, combine it with other (also unreliable) data sources, as in Phil Frost's answer, using a Kalman filter.